﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Surface;
using Microsoft.Surface.Core;

namespace Sublimation
{
    class WorldProperties_Surf : WorldProperties
    {
        protected ReadOnlyContactCollection contacts;
        public ReadOnlyContactCollection Contacts
        {
            get
            {
                return contacts;
            }
            set
            {
                contacts = value;
            }
        }

        //list of contacts that can by owned by an object
        protected List<int> owned;
        public List<int> Owned
        {
            get
            {
                return owned;
            }
        }

        public WorldProperties_Surf(Game game)
            : base(game)
        {
            owned = new List<int>();
        }

        public override void GeneratePlayers(){
            Players = new Player[playerCount];
            for (int i = 0; i < playerCount; i++)
            {
                Players[i] = new PlayerSurf(Game,this);
            }
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            physicalMap.clean();
            foreach (Contact contact in Contacts)
            {
                if (!contact.IsFingerRecognized && !contact.IsTagRecognized)
                {
                   physicalMap.add_rectangle(new Rectangle((int)contact.Bounds.Left,(int)contact.Bounds.Top,(int)contact.Bounds.Width,(int)contact.Bounds.Height));
                }
            }
        }
    }
}
